﻿using System.Net;
using System.Web;

namespace Risesun.Web
{
    public class HttpHandler : IHttpHandler
    {

        static HttpHandler()
        {

        }

        public void ProcessRequest(HttpContext context)
        {
            var func = HttpWebPageHolder.Current[context];
            if (func == null)
            {
                var exception = new HttpException(404, "lvtinger");
                throw exception;
            }

            var action = func(context);

            context.Response.Write(action.Visit());
        }

        public bool IsReusable
        {
            get { return true; }
        }
    }
}